//     https://www.nowcoder.com/practice/c43a0d72d29941c1b65c857d8ac9047e



#include <string>
class Solution
{
public:
    string compressString(string param)
    {
        string ans;
        int l = 0, r = 0, num = 0;
        while (r < param.size())
        {
            while (param[l] == param[r])
            {
                r++;
                num++;
            }
            ans += param[l];
            if (num > 1) ans += to_string(num);
            num = 0;
            l = r;
        }
        return ans;
    }
};